define(['./../initial'], function () {
    var app = angular.module('App.home');
    app.directive('singlePointChart', ['$timeout', 'chartFactory', 'reportDateFac', function ($timeout, chartFactory, reportDateFac) {
        return {
            restrict: 'AE',
            scope: {
                curPrj: '=',
                ptName: '=',
                pointStartDate: '=',
                pointEndDate: '='
            },
            link: function (scope, iElement, iAttrs) {
                $('#singlePointChart').modal('show');
                scope.pointQuery = function () {
                    return scope.curPrj.getSinglePointChange(scope.ptName, scope.pointStartDate, scope.pointEndDate).then(function (data) {
                        return chartFactory.createSinglePointChangesChart('#singleChart', data, scope.curPrj);
                    });
                };
                scope.pointQuery();
            },
            replace: true,
            templateUrl: '/partials/singlePointChart.html'
        };
    }]);
});
